package com.atguigu.dga.governance.service.impl;

import com.atguigu.dga.governance.bean.GovernanceAssessGlobal;
import com.atguigu.dga.governance.bean.GovernanceAssessTable;
import com.atguigu.dga.governance.mapper.GovernanceAssessGlobalMapper;
import com.atguigu.dga.governance.service.GovernanceAssessGlobalService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.dynamic.datasource.annotation.DS;

import java.util.List;

/**
 * <p>
 * 治理总考评表 服务实现类
 * </p>
 *
 * @author zhangchen
 * @since 2024-08-02
 */
@Service
@DS("dga")
public class GovernanceAssessGlobalServiceImpl extends ServiceImpl<GovernanceAssessGlobalMapper, GovernanceAssessGlobal> implements GovernanceAssessGlobalService {


    public  void  generateAssess(String assessDate){
        // 1.先删除之前的数据
        this.remove(new QueryWrapper<GovernanceAssessGlobal>().eq("assess_date",assessDate));
        // 2.根据考评结果汇总表级考评结果
        List<GovernanceAssessGlobal> governanceAssessGlobalList = this.baseMapper.selectAssessGlobalList(assessDate);
        //3 保存
        this.saveBatch(governanceAssessGlobalList);

    }
}
